﻿using ServerFrame;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Servertest
{
    public class AbsBroadcastHandler:AbsOnceHandler
    {
        /// <summary>
        /// 广播消息
        /// </summary>
        /// <param name="tokens"></param>
        /// <param name="command"></param>
        public void Broadcast(List<MyToken> tokens, int command)
        {
            Broadcast(tokens, Logic_area, command);
        }

        /// <summary>
        /// 广播消息
        /// </summary>
        /// <param name="tokens"></param>
        /// <param name="area"></param>
        /// <param name="command"></param>
        public void Broadcast(List<MyToken> tokens, int area, int command) {
            Broadcast(tokens, area, command, null);
        }

        public void Broadcast(List<MyToken> tokens,int area,int command,object message)
        {
            Broadcast(tokens, new TransModel(Logic_Type, area, command, message));
        }

        public void Broadcast(List<MyToken>tokens,TransModel model)
        {
            foreach (MyToken item in tokens)
            {
                Send(item,model);
            }
        }
    }
}
